class loginbean {
  int multiDepart;
  UserInfo userInfo;
  List<Departs> departs;
  String token;

  loginbean({this.multiDepart, this.userInfo, this.departs, this.token});

  loginbean.fromJson(Map<String, dynamic> json) {
    multiDepart = json['multi_depart'];
    userInfo = json['userInfo'] != null
        ? new UserInfo.fromJson(json['userInfo'])
        : null;
    if (json['departs'] != null) {
      departs = new List<Departs>();
      json['departs'].forEach((v) {
        departs.add(new Departs.fromJson(v));
      });
    }
    token = json['token'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['multi_depart'] = this.multiDepart;
    if (this.userInfo != null) {
      data['userInfo'] = this.userInfo.toJson();
    }
    if (this.departs != null) {
      data['departs'] = this.departs.map((v) => v.toJson()).toList();
    }
    data['token'] = this.token;
    return data;
  }
}

class UserInfo {
  String id;
  String username;
  String realname;
  String password;
  String salt;
  String avatar;
  String birthday;
  int sex;
  String email;
  String phone="";
  String orgCode;
  int status;
  String delFlag;
  String createBy;
  String createTime;
  String updateBy;
  String updateTime;
  String activitiSync;
  String hotuserId;
  int amHotuser;

  UserInfo(
      {this.id,
        this.username,
        this.realname,
        this.password,
        this.salt,
        this.avatar,
        this.birthday,
        this.sex,
        this.email,
        this.phone,
        this.orgCode,
        this.status,
        this.delFlag,
        this.createBy,
        this.createTime,
        this.updateBy,
        this.updateTime,
        this.activitiSync,
        this.hotuserId,
        this.amHotuser});

  UserInfo.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    username = json['username'];
    realname = json['realname'];
    password = json['password'];
    salt = json['salt'];
    avatar = json['avatar'];
    birthday = json['birthday'];
    sex = json['sex'];
    email = json['email'];

    if(null !=json['phone']){
      phone = json['phone'];
    }else{
      phone = "";
    }



    orgCode = json['orgCode'];
    status = json['status'];
    delFlag = json['delFlag'];
    createBy = json['createBy'];
    createTime = json['createTime'];
    updateBy = json['updateBy'];
    updateTime = json['updateTime'];
    activitiSync = json['activitiSync'];
    hotuserId = json['hotuserId'];
    amHotuser = json['amHotuser'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['username'] = this.username;
    data['realname'] = this.realname;
    data['password'] = this.password;
    data['salt'] = this.salt;
    data['avatar'] = this.avatar;
    data['birthday'] = this.birthday;
    data['sex'] = this.sex;
    data['email'] = this.email;
    data['phone'] = this.phone;
    data['orgCode'] = this.orgCode;
    data['status'] = this.status;
    data['delFlag'] = this.delFlag;
    data['createBy'] = this.createBy;
    data['createTime'] = this.createTime;
    data['updateBy'] = this.updateBy;
    data['updateTime'] = this.updateTime;
    data['activitiSync'] = this.activitiSync;
    data['hotuserId'] = this.hotuserId;
    data['amHotuser'] = this.amHotuser;
    return data;
  }
}

class Departs {
  String id;
  String parentId;
  String departName;
  String departNameEn;
  String departNameAbbr;
  int departOrder;
  String description;
  String orgType;
  String orgCode;
  String mobile;
  String fax;
  String address;
  String memo;
  String status;
  String delFlag;
  String createBy;
  String createTime;
  String updateBy;
  String updateTime;

  Departs(
      {this.id,
        this.parentId,
        this.departName,
        this.departNameEn,
        this.departNameAbbr,
        this.departOrder,
        this.description,
        this.orgType,
        this.orgCode,
        this.mobile,
        this.fax,
        this.address,
        this.memo,
        this.status,
        this.delFlag,
        this.createBy,
        this.createTime,
        this.updateBy,
        this.updateTime});

  Departs.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    parentId = json['parentId'];
    departName = json['departName'];
    departNameEn = json['departNameEn'];
    departNameAbbr = json['departNameAbbr'];
    departOrder = json['departOrder'];
    description = json['description'];
    orgType = json['orgType'];
    orgCode = json['orgCode'];
    mobile = json['mobile'];
    fax = json['fax'];
    address = json['address'];
    memo = json['memo'];
    status = json['status'];
    delFlag = json['delFlag'];
    createBy = json['createBy'];
    createTime = json['createTime'];
    updateBy = json['updateBy'];
    updateTime = json['updateTime'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['parentId'] = this.parentId;
    data['departName'] = this.departName;
    data['departNameEn'] = this.departNameEn;
    data['departNameAbbr'] = this.departNameAbbr;
    data['departOrder'] = this.departOrder;
    data['description'] = this.description;
    data['orgType'] = this.orgType;
    data['orgCode'] = this.orgCode;
    data['mobile'] = this.mobile;
    data['fax'] = this.fax;
    data['address'] = this.address;
    data['memo'] = this.memo;
    data['status'] = this.status;
    data['delFlag'] = this.delFlag;
    data['createBy'] = this.createBy;
    data['createTime'] = this.createTime;
    data['updateBy'] = this.updateBy;
    data['updateTime'] = this.updateTime;
    return data;
  }
}